<?php
namespace Client\Model;
use Think\Model;

class PublishModel extends Model{
	//self::MUST_VALIDATE 1 必须验证
	protected $_validate=array(
		array('aid','require','用户ID不能为空',self::MUST_VALIDATE,'regex'),
		array('content','require','发布内容不能为空',self::MUST_VALIDATE,'regex'),
	);
	protected $_auto 	=array(
		array('ctime','getCtime',self::MODEL_INSERT,'callback'),
		array('id','getId',self::MODEL_INSERT,'callback') , // 对id字段在新增的时候自动生成一个ID
	);
	function getId(){
		$util = A('Util');
		return  'P'.$util->getId();//生成用户ID
	}
	function getCtime(){
		return date('Y-m-d H:i:s');
	}
}
?>